<?php
namespace app\admin\controller;
use houdunwang\model\Model;
use system\model\User;
class Login
{
	public function index(){
	   if (IS_POST){
		  $res=(new User())->login();
//		  var_dump($res);
		  if ($res){
			 message( '登录成功', u('admin.index.index'), $type = 'success', $timeout = 2 );
		  }
		  message( (new User())->getError(), $redirect = 'back', $type = 'error', $timeout = 2 );
	   }
	   return view();
	}
	public function code(){
	   Code::num(1)->make();
	}
}